package com.pivotal.cloud.security.password.factory;

import com.pivotal.cloud.security.password.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @className: factory.PasswordEncoderFactory
 * @projectName: PivotalCloud项目
 * @module: PivotalCloud项目-PasswordEncoderFactory类，主要位于Security安全模块-密码加密工厂类模块
 * @content: PasswordEncoderFactory-密码加密工厂类
 * @author: Powered by Marklin
 * @datetime: 2025-06-24 13:16
 * @version: 1.0.0
 * @copyright: Copyright © 2018-2025 PivotalCloud Systems Incorporated. All rights
 * reserved.
 */
public final class PasswordEncoderFactory {

	private PasswordEncoderFactory() {
	}

	@SuppressWarnings("deprecation")
	public static PasswordEncoder createPasswordEncoder() {
		String encodingId = "bcrypt";
		Map<String, PasswordEncoder> encoders = new HashMap<>();
		encoders.put(encodingId, BCryptPasswordEncoder.getInstance());
		encoders.put("ldap", LdapShaPasswordEncoder.getInstance());
		encoders.put("MD4", Md4PasswordEncoder.getInstance());
		encoders.put("MD5", MessageDigestPasswordEncoder.getInstance());
		encoders.put("noop", NoopPasswordEncoder.getInstance());
		encoders.put("pbkdf2", Pbkdf2PasswordEncoder.getInstance());
		encoders.put("scrypt", SCryptPasswordEncoder.getInstance());
		encoders.put("SHA-1", MessageDigestPasswordEncoder.getInstance());
		encoders.put("SHA-256", MessageDigestPasswordEncoder.getInstance());
		encoders.put("argon2", Argon2PasswordEncoder.getInstance());
		return new DelegatePasswordEncoder(encodingId, encoders);
	}

}
